🎖️GitЯра🎖️
Node / meshtastic / Meshtastic-Android / files / app / src / main / java / com / geeksville / mesh / repository / bluetooth / BluetoothBroadcastReceiver.kt
Displaying Raw • Download
app/src/main/java/com/geeksville/mesh/repository/bluetooth/BluetoothBroadcastReceiver.kt 78274c792318331b11ab64cd28e58e829875b8c2 (78274c79) Text, 2.17 KB
T8b949e/*
* Copyright (c) 2025 Meshtastic LLC
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
Tff7b72package T7ee787com.geeksville.mesh.repository.bluetooth
Tff7b72import T7ee787android.bluetooth.BluetoothAdapter
Tff7b72import T7ee787android.bluetooth.BluetoothDevice
Tff7b72import T7ee787android.content.BroadcastReceiver
Tff7b72import T7ee787android.content.Context
Tff7b72import T7ee787android.content.Intent
Tff7b72import T7ee787android.content.IntentFilter
Tff7b72import T7ee787com.geeksville.mesh.util.exceptionReporter
Tff7b72import T7ee787javax.inject.Inject
T8b949e/**
* A helper class to call onChanged when bluetooth is enabled or disabled
*/
Tff7b72class T56d364BluetoothBroadcastReceiver Tf0883e@Inject Tff7b72constructorTb4b4b4(
Tff7b72private Tff7b72val Te6edf3bluetoothRepositoryTb4b4b4: Te6edf3BluetoothRepository
Tb4b4b4) Tb4b4b4: Te6edf3BroadcastReceiverTb4b4b4(Tb4b4b4) Tb4b4b4{
Tff7b72internal Tff7b72val Te6edf3intentFilter Tff7b72getTb4b4b4(Tb4b4b4) Tff7b72= Te6edf3IntentFilterTb4b4b4(Tb4b4b4)Tb4b4b4.Te6edf3apply Tb4b4b4{
Te6edf3addActionTb4b4b4(Te6edf3BluetoothAdapterTb4b4b4.Te6edf3ACTION_STATE_CHANGEDTb4b4b4)
Te6edf3addActionTb4b4b4(Te6edf3BluetoothDeviceTb4b4b4.Te6edf3ACTION_BOND_STATE_CHANGEDTb4b4b4)
Tb4b4b4}
Tff7b72override Tff7b72fun Td2a8ffonReceiveTb4b4b4(Te6edf3contextTb4b4b4: Te6edf3ContextTb4b4b4, Te6edf3intentTb4b4b4: Te6edf3IntentTb4b4b4) Tff7b72= Te6edf3exceptionReporter Tb4b4b4{
Tff7b72if Tb4b4b4(Te6edf3intentTb4b4b4.Te6edf3action Tff7b72=Tff7b72= Te6edf3BluetoothAdapterTb4b4b4.Te6edf3ACTION_STATE_CHANGEDTb4b4b4) Tb4b4b4{
Tff7b72when Tb4b4b4(Te6edf3intentTb4b4b4.Te6edf3bluetoothAdapterStateTb4b4b4) Tb4b4b4{
T8b949e// Simulate a disconnection if the user disables bluetooth entirely
Te6edf3BluetoothAdapterTb4b4b4.Te6edf3STATE_OFF Tff7b72-Tff7b72> Te6edf3bluetoothRepositoryTb4b4b4.Te6edf3refreshStateTb4b4b4(Tb4b4b4)
Te6edf3BluetoothAdapterTb4b4b4.Te6edf3STATE_ON Tff7b72-Tff7b72> Te6edf3bluetoothRepositoryTb4b4b4.Te6edf3refreshStateTb4b4b4(Tb4b4b4)
Tb4b4b4}
Tb4b4b4}
Tff7b72if Tb4b4b4(Te6edf3intentTb4b4b4.Te6edf3action Tff7b72=Tff7b72= Te6edf3BluetoothDeviceTb4b4b4.Te6edf3ACTION_BOND_STATE_CHANGEDTb4b4b4) Tb4b4b4{
Te6edf3bluetoothRepositoryTb4b4b4.Te6edf3refreshStateTb4b4b4(Tb4b4b4)
Tb4b4b4}
Tb4b4b4}
Tff7b72private Tff7b72val Te6edf3IntentTb4b4b4.Te6edf3bluetoothAdapterStateTb4b4b4: Tffa657Int
Tff7b72getTb4b4b4(Tb4b4b4) Tff7b72= Te6edf3getIntExtraTb4b4b4(Te6edf3BluetoothAdapterTb4b4b4.Te6edf3EXTRA_STATETb4b4b4, Tff7b72-T79c0ff1Tb4b4b4)
Tb4b4b4}
Served by rngit 1.5.0 - Generated in 0.05s